<?php
// @formatter:off
/**
 * @file s.mobile.php
 * @author Alejandro Dario Simi
 * @date $Date: 2013-05-13 04:08:49 +0000 (Mon, 13 May 2013) $
 *
 * $Id: s.mobile.php 64 2013-05-13 04:08:49Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0/services/s.mobile.php $
 */
// @formatter:on

$noCache = true;
$wcServiceStatus = false;
$wcServiceErrorCode = 500;

if(defined('__SERVICE__')) {
	if($_SERVER["REQUEST_METHOD"] == "POST") {
		if(isset($_REQUEST["mobile"])) {
			if(strtolower($_REQUEST["mobile"]) == "on") {
				$lifetime = time() + (86400 * 7);
				setcookie(WC_COOKIE_MOBILE_MODE, "ON", $lifetime);
			} else {
				setcookie(WC_COOKIE_MOBILE_MODE, "", 1);
			}

			$wcServiceStatus = true;
		} else {
			$wcServiceErrorMsg = "Parameter 'mobile' was not given";
		}
	} else {
		$wcServiceErrorCode = 403;
		$wcServiceErrorMsg = "This service only works on POST method";
	}
}
?>